package com.ms.game.rebate.db;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.ms.game.rebate.RebateModifyStatus;
import com.xpec.c4.db.model.basic.BasicGameModel;

/**
 * 回饋金Model
 *  @author Sean Wang
 * */

@Entity
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name = "rebate_coins")

@org.hibernate.annotations.Table(
		appliesTo = "rebate_coins", indexes = {
				@org.hibernate.annotations.Index(name = "INDEX_UPLINE_INVITE_REWARD", columnNames = { "uplineId", "downlineId", "type", "status" })
		})
public class RebateModel  extends BasicGameModel {
	public RebateModel(){
		
		lastModifyTime = Calendar.getInstance();
		
		status = 0;
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5472891330049732092L;
	
	/**
	 * 上線GUID
	 */
	private String uplineId;
	
	/**
	 * 下線GUID
	 */
	private String downlineId;
	
	/**
	 * 下線名稱
	 */
	private String downlineName;

	/**
	 * 回饋金的type
	 */
	private int type;
	
	/**
	 * type的註解
	 */
	private String typeDesc;

	/**
	 * 回饋金
	 */
	private BigDecimal totalRebateCoin;
	
	/**
	 * 最後異動時間
	 */
	private Calendar lastModifyTime;

	/**
	 * 屬於哪一天(Date)
	 * @return
	 */
	private Date belongsDate;
	
	/**
	 * 結束在哪一天(date)
	 */
	private Date endDate;

	/**
	 * 回饋金狀態 
	 * 0 = 未領取 
	 * 1 = 以領取
	 * 2 = 過期刪除
	 * @see RebateModifyStatus
	 */
	private int status;
	
	
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getBelongsDate() {
		return belongsDate;
	}

	public void setBelongsDate(Date belongsDate) {
		this.belongsDate = belongsDate;
	}

	public String getUplineId() {
		return uplineId;
	}

	public void setUplineId(String uplineId) {
		this.uplineId = uplineId;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}
	
	@Column(precision = 19, scale = 2, columnDefinition = "DECIMAL(19,2) default 0.0")
	public BigDecimal getTotalRebateCoin() {
		return totalRebateCoin;
	}

	public void setTotalRebateCoin(BigDecimal rebateCoin) {
		this.totalRebateCoin = rebateCoin;
	}

	public Calendar getLastModifyTime() {
		return lastModifyTime;
	}

	public void setLastModifyTime(Calendar lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}
	
	
	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	
	
	public String getDownlineId() {
		return downlineId;
	}

	public void setDownlineId(String downlineId) {
		this.downlineId = downlineId;
	}

	public String getDownlineName() {
		return downlineName;
	}

	public void setDownlineName(String downlineName) {
		this.downlineName = downlineName;
	}
	
	public String getTypeDesc() {
		return typeDesc;
	}

	public void setTypeDesc(String typeDesc) {
		this.typeDesc = typeDesc;
	}

}
